package com.wg.dome.entity.user;


import com.wg.core.annotation.DataMember;
import com.wg.core.lang.HashTable;
import com.wg.db.annotation.EntityField;
import com.wg.db.annotation.EntityTable;

import java.io.Serializable;

/**
 * 玩家道具
 */
@EntityTable(tableName = "user_item", isGrouping = true, groupName = "player_id")
public class ItemEntity implements Serializable {

    /**
     * 唯一ID
     */
    @DataMember(code = 1)
    @EntityField(isKey = true)
    private int id;

    /**
     * 静态id
     */
    @DataMember(code = 2)
    @EntityField(fieldName = "s_id")
    private int sId;

    /**
     * 玩家id
     */
    @DataMember(code = 3)
    @EntityField(fieldName = "player_id")
    private long playerId;

    /**
     * 数量
     */
    @DataMember(code = 4)
    @EntityField
    private int count;

    public ItemEntity() {

    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getsId() {
        return sId;
    }

    public void setsId(int sId) {
        this.sId = sId;
    }

    public long getPlayerId() {
        return playerId;
    }

    public void setPlayerId(long playerId) {
        this.playerId = playerId;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public HashTable toHashTable() {
        HashTable hashTable = new HashTable(2);
        hashTable.put((byte) 1, sId);
        hashTable.put((byte) 2, count);
        return hashTable;
    }
}
